//package com.smallkingson.ylib.view.adapter;
//
//import android.os.AsyncTask;
//import android.support.v7.util.DiffUtil;
//
//import java.util.List;
//
///**
// * Created by Administrator on 2016/10/8.
// */
//
//public abstract class YDiffAapter<T extends YDiffCallback.DiffComparable> extends YRecyclerAdapter {
//
//    /**
//     * 执行完毕后新的数据会覆盖旧的数据
//     * @param olds
//     * @param news
//     */
//    void refresh(final List<T> olds, final List<T> news){
//         YDiffCallback diffCallback = new YDiffCallback(olds, news);
//        new AsyncTask<YDiffCallback, Void, DiffUtil.DiffResult>() {
//            @Override
//            protected DiffUtil.DiffResult doInBackground(YDiffCallback... params) {
//                YDiffCallback diffCallback = params[0];
//                return  DiffUtil.calculateDiff(diffCallback);
//            }
//            @Override
//            protected void onPostExecute(DiffUtil.DiffResult diffResult) {
//                diffResult.dispatchUpdatesTo(YDiffAapter.this);
//                olds.clear();
//                olds.addAll(news);
//                onDiffAfter();
//            }
//        }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, diffCallback);
//    }
//
//    protected  void onDiffAfter(){
//
//    };
//}
